package com.demo.user.elasticjob;

import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.elasticjob.api.ShardingContext;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
import org.springframework.stereotype.Component;

/**
 * 第一个测试任务
 *
 * @author DayDayUp
 * create on 2023-07-26
 **/
@Slf4j
@Component
public class TestJob1 implements SimpleJob {
    @Override
    public void execute(ShardingContext shardingContext) {
        switch (shardingContext.getShardingItem()) {
            case 0:
                log.info("第0个分片任务正在执行...");
                break;
            case 1:
                log.info("第1个分片任务正在执行...");
                break;
            case 2:
                log.info("第2个分片任务正在执行...");
                break;
            case 3:
                log.info("第3个分片任务正在执行...");
                break;
            case 4:
                log.info("第4个分片任务正在执行...");
                break;
            default:
                log.info("默认分片任务正在执行...");
                break;
        }
    }
}
